Skip to main content

Get Media By ID

GET /media/:mediaId​

Description​

Returns a public media document if the authenticated viewer is allowed to access the resource it belongs to.

If the media belongs to a post, the API also checks post visibility against the current viewer.

Request Parameters​

Requires Authentication: true​

PATH PARAMS​

NameTypeRequiredDescription
mediaIdstringYesMedia ID.

Usage Example​

await axios.get(
"https://api.daykeeper.app/media/67d9dc91cc9e4db02fca3501",
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
}
)

Success Response​

{
"message": "Media fetched successfully",
"media": {
"_id": "67d9dc91cc9e4db02fca3501",
"status": "public"
}
}

Error Response​

CodeDescription
401Missing or invalid access token
404Media not found or not visible to the viewer
413Media ID too long
500Server error